package com.qidian.mes.qc.controller;

import com.qidian.mes.pojo.QcDefect;
import com.qidian.mes.qc.service.DefectService;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 朱静炜
 * @Company 起点编程
 * @Time 2023/10/25 18:12
 * @Description
 */
@RestController
@CrossOrigin
@RequestMapping("/defect")
public class DefectController {
    @Autowired
    private DefectService defectService;

    @DeleteMapping("/delete")
    public MESResult deleteId(Long defectId){
        return defectService.delete(defectId);
    }
    @GetMapping("/selectById")
    public MESResult selectById(Long defectId){
        return defectService.getById(defectId);
    }

    @PutMapping("/update")
    public MESResult update(@RequestBody QcDefect qcDefect){
        return defectService.update(qcDefect);
    }

    @PostMapping("/save")
    public MESResult save(@RequestBody QcDefect qcDefect){
        return defectService.save(qcDefect);
    }

    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, QcDefect qcDefect){
        return defectService.list(qcDefect,page,limit);
    }
}
